<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #one
        {
            width: 50px;
            height: 300px;
            margin-left: 0px;
            float: left;
            margin-top: 300px;
            background-color: aqua;
            border-style: dashed;
            cursor: pointer;
            text-align: center;
            padding-top: 145px;
        }
        #two
        {
            width: 50px;
            height: 300px;
            margin-left: 0px;
            float: left;
            margin-top: 300px;
            background-color: aqua;
            border-style: dashed;
            display: none;
            text-align: center;
            padding-top: 145px;
        }
        #three
        {
           border-width: 50px;
            width: 100px;
            height: 30px;
            text-align: center;
            padding-top: 10px;
            background-color: #362b9a00;
            margin-top: 600px;
            margin-left: 300px;
            color: cadetblue;
            border-style: double;

        }
        #pp
        {
            width: 80px;
            height: 20px;
            border-width: 2px;

        }
        #uu
        {
            width: 300px;
            height: 300px;
            margin: auto;
        }
        #img1
        {   
            width: 200px;
            height: 200px;
            padding-left: 80px;
            padding-top: 50px;

        }
    </style>
</head>
<body>
    <a href="page two第五章实践.html">页面二</a>//不要忘记括号
    <button onclick="history.back()">上一页</button>
    <button onclick="history.forward()">下一页</button>
    <button onclick="history.go(0)">首页</button>//返回上页下页要求之前有过历史记录<br>
    <div id="one" onclick="fun()">展开</div>
    <div id="two">隐藏内容</div><br><br>
    <div id="three" onclick="clikf()" onmousedown="put()"  onmouseout="leva()" onmousemove="move()"> 鼠标事件</div>
    <input type="text" id="input1" onkeydown="anxa()" onkeypress="re()" onkeyup="up()">
    <div id="pp"></div><br>
    <form action="" onreset="rest()" onsubmit="mt()" onchange="cg()">
        名字：<input type="text" id="nam"><br>
       号码：<input type="text" id="tel"><br>
        <select  id="grade">
            <option value="高一">高一</option>
            <option value="高二">高二</option>
            <option value="高三">高三</option>
        </select><span id="span1"></span><br><br>
        <input type="reset">
        <input type="submit">
    </form>
    <div id="uu" onmousemove="ov()" onmouseout="ot()" onmousedown="dw()" onmouseup="ump()">
        <img src="img/2.jpg" id="img1" alt="">
    </div>
</body>
<script>
    // document.write("navigator显示浏览器基本信息："+"</p>")
    // document.write("浏览器的版本"+navigator.appName+"</p>")
    // document.write("</p>代码"+navigator.appCodeName+"</p>")
    // document.write("<p>平台"+navigator.platform+"</p>")
    // document.write("</p>Cookies 启用")
    // document.write(navigator.cookieEnabled+"</p>")
    // document.write("<p>浏览器用户代理报头")
    // document.write(navigator.userAgent+"</p>")

    function fun()
    {
    let a=document.getElementById("one")
    let b=document.getElementById("two")
    let c=one.innerHTML;
    if(c=="展开")
    {
        one.innerHTML="折叠"
        b.style.display="block"
    }
    else
    {
        one.innerHTML="展开"
        b.style.display="none"
    }
    }

    let d=document.getElementById("three")
    function clikf()
    {
        d.innerHTML="点击事件";//与按下鼠标差不多
        d.style.color="red"
    }
    function put()
    {
        d.innerHTML="按下鼠标";
        d.style.color="blue"
    }
    function leva()
    {
        d.innerHTML="离开元素";
        d.style.color="pink"
    }
    function move()
    {
        d.innerHTML="正在移动";
        d.style.color="green"
    }
//显示按键状态
    let k=document.getElementById("input1")
    let h=document.getElementById("pp")
    function anxa()
    {
        h.innerHTML="按下按键"
        k.style.backgroundColor="pink"
    }
    function re()
    {
        h.innerHTML="按下按键并释放按键"
        k.style.backgroundColor="red"
    }
    function up()
    {
        h.innerHTML="释放按键"
        k.style.backgroundColor="blue"
    }
//表单事件
function rest()
{
    alert("按确认重置！！")
}

function mt()
{
    let o=document.getElementById("nam").value
    let w=document.getElementById("tel").value
    let gd=document.getElementById("grade").value
    if(o=="")
{
    alert("名字为空！")
}
else if(w.length!=11)
{
    alert("号码填错了！！！")
}
else
{
    alert("表单提交成功")
}
}

//图片交互
let q=document.getElementById("uu")
let e=document.getElementById("img1")
function ov()
{
    q.style.border="5px red solid"

}
function ot ()
{
    q.style.border=""

}
function dw()
{
    e.style.width="250px"
    e.style.height="250px"
    e.style.paddingTop="20px"
    e.style.paddingLeft="20px"

}
function ump()
{
    e.style.width="200px"
    e.style.height="200px"

}


</script>
</html>